import numpy as np
import matplotlib.pyplot as plt


def log_ssim(x: float)->float:
    assert 0 <= x < 1
    output = -10*np.log10(1-x)
    return output


data_code = dict()
data_estimate = dict()


data_code["0.0004"] = [0.06554326882697815, 23.507125549316406,  0.836916646361351]
data_code["0.0008"] = [0.142454719715047, 26.088411350250244, 0.9019372701644898]
# data_code["0.0032"] = [9.112641949865068e-05, 11.2793021774292, 0.3698855940997601]
# data_code["0.0075"] = [0.0001690079760353996, 11.27683319091797, 0.3672873989492655]
data_code["0.015"] = [1.268920859387352, 33.60080390930176, 0.9809887903928757]
data_code["normal_quanti"] = [0.714096, 30.31606952349345, 0.9623493254184723]
data_code["normal_compen"] = [0.6457066666666667, 31.13133994738261, 0.9735157564282417]


counts = 1
for key, value in data_code.items():
    # if counts == 1:
    #     plt.scatter(value[0], log_ssim(value[2]), color='blue', marker='o', label='code hyper')
    # else:
    #     plt.scatter(value[0], log_ssim(value[2]), color='blue', marker='o')
    # plt.scatter(value[0], log_ssim(value[2]), marker='o', label=key)
    plt.scatter(value[0], value[1], marker='o', label=key)
    # counts += 1

# for key, value in data_code.items():
#     if counts == 1:
#             plt.scatter(value[0], value[1], color='blue', marker='o', label='code hyper')
#     else:
#         plt.scatter(value[0], value[1], color='blue', marker='o')
#     counts += 1


# plt.scatter(a1[0], log_ssim(a1[2]), color='blue', marker='o', label='code hyper')
# plt.scatter(b1[0], log_ssim(b1[2]), color='blue', marker='x', label='code normal')
#
# plt.scatter(a2[0], log_ssim(a2[2]), color='red', marker='o', label='esimate hyper')
# plt.scatter(b2[0], log_ssim(b2[2]), color='red', marker='x', label='esimate normal')

plt.xlabel('Bit-rate[bpp]')
# plt.ylabel('psnr[dB]')
plt.ylabel('psnr[dB]')

plt.legend()
plt.savefig('./fig/kodak_psnr.png')
plt.show()



